---
page_title: "cloudflare_filter Resource - Cloudflare"
subcategory: ""
description: |-
  Filter expressions that can be referenced across multiple features,
  e.g. Firewall Rules. See what is a filter https://developers.cloudflare.com/firewall/api/cf-filters/what-is-a-filter/
  for more details and available fields and operators.
---

# cloudflare_filter (Resource)

Filter expressions that can be referenced across multiple features,
e.g. Firewall Rules. See [what is a filter](https://developers.cloudflare.com/firewall/api/cf-filters/what-is-a-filter/)
for more details and available fields and operators.

~> `cloudflare_filter` is in a deprecation phase that will last for one
  year (May 1st, 2024). During this time period, this resource is still fully
  supported but you are strongly advised to move to the
  `cloudflare_ruleset` resource. Full details can be found in the
  [developer documentation](https://developers.cloudflare.com/waf/reference/migration-guides/firewall-rules-to-custom-rules/#relevant-changes-for-terraform-users).


## Example Usage

```terraform
resource "cloudflare_filter" "wordpress" {
  zone_id     = "0da42c8d2132a9ddaf714f9e7c920711"
  description = "Wordpress break-in attempts that are outside of the office"
  expression  = "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.src ne 192.0.2.1"
}
```
<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `expression` (String) The filter expression to be used.
- `zone_id` (String) The zone identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**

### Optional

- `description` (String) A note that you can use to describe the purpose of the filter.
- `paused` (Boolean) Whether this filter is currently paused.
- `ref` (String) Short reference tag to quickly select related rules.

### Read-Only

- `id` (String) The ID of this resource.

## Import

Import is supported using the following syntax:

```shell
$ terraform import cloudflare_filter.example <zone_id>/<filter_id>
```
